import { AxiosResponse } from 'axios';
import { Get, Post } from '../axios';



/* 删除安卓应用*/
interface DelapkInterface {
    (data: {
        id: string,                     /*安卓应用id*/
    }): Promise<AxiosResponse<any>>
}
export const delapk: DelapkInterface = async (data) => {
    try {
        return await Post({ url: "/apkmod/delapk", data });
    } catch (error) {
        throw error
    }
}



/* 修改安卓应用 */
interface UpapkInterface {
    (data: {
        id: string,                    /* 安卓应用id */
        remarks?: string,              /* 备注 */
        merge?: string,                /* 合并参数 */
        codestatus?: boolean,          /* 是否需要下载码 */
        accountPool?: string           /* 证书池 */
    }): Promise<AxiosResponse<any>>
}
export const upapk: UpapkInterface = async (data) => {
    try {
        return await Post({ url: "/apkmod/upapk", data });
    } catch (error) {
        throw error
    }
}



/* 查询安卓应用 */
interface GetapkInterface {
    (data: {
        pageNo: number,                    /* 当前页数 */
        pageSize: number,                  /* 页面总条数 */
        id?: string | null
    }): Promise<AxiosResponse<any>>
}
export const getapk: GetapkInterface = async (data) => {
    try {
        return await Post({ url: "/apkmod/getapk", data });
    } catch (error) {
        throw error
    }
}



/* 搜索安卓应用 */
interface SchapkInterface {
    (data: {
        remarks: string                     /*备注*/
    }): Promise<AxiosResponse<any>>
}
export const schapk: SchapkInterface = async (data) => {
    try {
        return await Get({ url: "/apkmod/searchapk", data });
    } catch (error) {
        throw error
    }
}
